<template>
	<view class="body">
		<!-- <viwe style="height: 45rpx;"></viwe> -->
		<view class="headbox">
			<view class="headboxa">
				<view class="headboxa1">
					<image :src="[avatar?avatar:'/static/image/noimg.png']" mode="aspectFill"></image>
				</view>
				<view class="headboxa2">
					<view class="headboxa2a">
						{{userinfo.nickname}}
					</view>
					<view class="headboxa2b" v-if="userinfo.level!=2&&show==1" @tap="nexturl" data-url="/pages/member/viper" >
						<text class="icon-huiyuan iconfont"></text> {{userinfo.viper}}
					</view>
					
					<view class="headboxa2b" v-if="userinfo.level==2" data-url="/pages/member/viper" >
						<text class="icon-huiyuan iconfont"></text> {{userinfo.viper}}
					</view>
					
					
				</view>
				
				<view class="headboxa3" @tap="nexturl" data-url="/pages/member/set" >
					<text class="icon-shezhi iconfont"></text>
				</view>
			</view>
		</view>
		
		
		<view class="orderbox" v-if="1==2">
			<view class="orderbox1" @tap="nexturl" data-url="/pages/member/order?status=0">
				<image class="orderbox1_t" src="/static/image/order.png" mode=""></image>
				<view class="orderbox1_b">待支付</view>
			</view>
			<view class="orderbox1" @tap="nexturl" data-url="/pages/member/order?status=1">
				<image class="orderbox1_t" src="/static/image/order1.png" mode=""></image>
				<view class="orderbox1_b">已支付</view>
			</view>
			<view class="orderbox1" @tap="nexturl" data-url="/pages/member/order?status=3">
				<image class="orderbox1_t" src="/static/image/order3.png" mode=""></image>
				<view class="orderbox1_b">已取消</view>
			</view>
		
		</view>
		
		<view class="moretitle">
			常用功能
		</view>
		
		<view class="more_box">
			
			<view class="more_boxli"  v-if="show==1" @tap="nexturl" data-url="/pages/member/order" >
				<image class="more_boxli_img" src="/static/image/orderli.png" mode=""></image>
				<view class="more_boxli_txt">我的订单</view>
			</view>
			
			
			<view class="more_boxli" @tap="nexturl" data-url="/pages/down/index" >
				<image class="more_boxli_img" src="/static/image/hh.png" mode=""></image>
				<view class="more_boxli_txt">合伙人</view>
			</view>
			
			<view class="more_boxli"  @tap="nexturl" data-url="/pages/logs/mylike" >
				<image class="more_boxli_img" src="/static/image/sc.png" mode=""></image>
				<view class="more_boxli_txt">我的收藏</view>
			</view>
			
			<view class="more_boxli" @tap="nexturl" data-url="/pages/logs/mysee"  >
				<image class="more_boxli_img" src="/static/image/jl.png" mode=""></image>
				<view class="more_boxli_txt">我的浏览</view>
			</view>
			
			<view class="more_boxli" @tap="nexturl" data-url="/pages/mygood/index">
				<image class="more_boxli_img" src="/static/image/log.png" mode=""></image>
				<view class="more_boxli_txt">我的发布</view>
			</view>
			<view class="more_boxli" @tap="nexturls" data-url="/pages/mygood/address"  >
				<image class="more_boxli_img" src="/static/image/fb.png" mode=""></image>
				<view class="more_boxli_txt">发布信息</view>
			</view>
			
		
			<button open-type="contact" class="more_boxli_bt"  v-if="types=='wx'" >
				<image class="more_boxli_img" src="/static/image/kf.png" mode=""></image>
				<view class="more_boxli_txt">联系客服</view>
			</button>
			<button open-type="im" :data-im-id="im" @im="imCallback" @error="onimError" class="more_boxli_bt"  v-if="types=='tt'" >
				<image class="more_boxli_img" src="/static/image/kf.png" mode=""></image>
				<view class="more_boxli_txt">联系客服</view>
			</button>
			
			
			
			<view class="more_boxli" @tap="goexit"   >
				<image class="more_boxli_img" src="/static/image/exit.png" mode=""></image>
				<view class="more_boxli_txt">退出</view>
			</view>
		</view>
		
		<view style="height: 100rpx;"></view>
	</view>
</template>

<script>
	
		import {curl} from 'common/api.js';
		
	export default {
		data() {
			return {
				show:0,
				avatar:'',
				userinfo:'',
				types:'wx',
				im:''
			}
		},
		
		onShow() {
			var that=this;
			curl('member/getuserinfo', {}).then((res) => {
				console.log('用户信息',res.data);
				that.userinfo=res.data;
				that.avatar=res.data.avatar;
			});
			
			
			curl('index/getmoneyset', {}).then((res) => {
				console.log('Im信息',res.data);
		
				that.im=res.data.ttim;
			});
			
			// #ifdef MP-WEIXIN
			that.types='wx';
			// #endif
			
			//#ifdef MP-TOUTIAO 
			that.types='tt';
			// #endif
					
			// this.ttlogin();
				
				var that=this;
				curl('index/getshow', {}).then((res) => {
					that.show=res.data.show;
				});
				
		},
		
		methods: {
			
			goexit(){
				uni.setStorageSync('userinfo','');
				uni.setStorageSync('token','');
				
				uni.reLaunch({
					url:"/pages/login/login"
				})
			},
			imCallback:function(e){  
			  console.log("跳转IM客服成功", e.detail);  
			},  
			onimError:function(e) {  
	              console.log("拉起IM客服失败", e.detail);  
	            },
			nexturl(ret){
			
				var url=ret.currentTarget.dataset.url;
				uni.navigateTo({
					url:url
				})
			},
			nexturls(ret){
				
				var url=ret.currentTarget.dataset.url;
				uni.switchTab({
					url:url
				})
			}
	
		}
	}
</script>

<style>
	.more_boxli_txt{
		width: 100%;height: 50rpx;
		text-align: center;line-height: 50rpx;
		font-size: 28rpx;flex-wrap: 500;
	}
	.more_boxli_img{
		width: 70rpx;height: 70rpx;margin-top: 40rpx;
	}
	.more_boxli{
		height:190rpx ;width: 25%;
		text-align: center;position: relative;
	}
	
	.more_boxli_bt::after{
		border: none;
	}
	.more_boxli_bt{
		height:190rpx ;width: 25%;
		background: none;margin: 0px;padding: 0px;
		line-height: 0px;
	}
	.more_boxli_bt>.more_boxli_txt{
		line-height: 70rpx !important;
	}
	
	.more_box{
		width: 700rpx;height: auto;margin: auto;
		background: #ffffff;border-radius: 10rpx;
		display: flex;flex-wrap: wrap;
	}
	
	.moretitle{
		width: 700rpx;height: 120rpx;
		margin: auto;
		line-height: 120rpx;font-weight: bold;font-size: 32rpx;
	}
	
	.orderbox1_b{
		height: 50rpx;line-height: 50rpx;
		font-size: 28rpx;color: #333333;
	}
	.orderbox1_t{
		width: 70rpx;height: 70rpx;
	}
	.orderbox1{
		width: 33%;height: 140rpx;
		text-align: center;
	}
	.orderbox{
		width: 700rpx;height: 200rpx;margin: auto;
		margin-top: -90rpx;background: #ffffff;border-radius: 10rpx;
		display: flex;align-items: center;justify-content: space-between;
	}
	
	.headboxa3>text{
		font-weight: bold;
		font-size: 34rpx;color: #ffffff;
	}
	.headboxa3{
		width: 50rpx;height: 120rpx;
	}
	.headboxa2b>text{
		margin-right: 5rpx;
	}
	.headboxa2b{
		height: 50rpx;line-height:60rpx;
		font-size: 28rpx;color: #fafafa;font-weight: 400;
	}
	.headboxa2a{
		height: 50rpx;line-height: 60rpx;
		font-size: 32rpx;color: #ffffff;font-weight: 500;
	}
	.headboxa2{
		width: 450rpx;height: 100rpx;
	}
	.headboxa1>image{
		width: 130rpx;height: 130rpx;border-radius: 130rpx;
	}
	.headboxa1{
		width: 130rpx;height: 130rpx;border-radius: 130rpx;margin-right: 20rpx;
	}
	.headboxa{
		width: 650rpx;height: 200rpx;margin: auto;
		display: flex;align-items: center;justify-content: space-between;
	}
	.headbox{
		width: 100%;height: 290rpx;background: #61c77b;
	}
	.body{
		background: #f3f3f3 !important;
		min-height: 100vh;
	}
</style>
